class Solution
{
public:
    void moveZeroes(vector<int>& nums)
    {
        int dest = -1, cur = 0;
        while (cur < nums.size())
        {
            if (nums[cur] == 0) cur++;
            else if (nums[cur] != 0)
            {
                swap(nums[dest + 1], nums[cur]);
                dest++, cur++;
            }
        }
    }
};